package com.baseweb.webadmin.core.model.mapper;

import com.baseweb.webadmin.core.model.pojo.PushRecord;
import com.baseweb.webadmin.core.model.pojo.PushRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface PushRecordMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    int countByExample(PushRecordExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    int deleteByExample(PushRecordExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    @Delete({
        "delete from push_record",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    @Insert({
        "insert into push_record (name, title, ",
        "content, operator, ",
        "description, status, ",
        "send_time, ",
        "create_time, ",
        "update_time)",
        "values (#{name,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, ",
        "#{content,jdbcType=VARCHAR}, #{operator,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{sendTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}, ",
        "#{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(PushRecord record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    int insertSelective(PushRecord record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    List<PushRecord> selectByExample(PushRecordExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    @Select({
        "select",
        "id, name, title, content, operator, description, status, send_time, create_time, ",
        "update_time",
        "from push_record",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    PushRecord selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    int updateByExampleSelective(@Param("record") PushRecord record, @Param("example") PushRecordExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    int updateByExample(@Param("record") PushRecord record, @Param("example") PushRecordExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    int updateByPrimaryKeySelective(PushRecord record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table push_record
     *
     * @mbggenerated Thu Sep 18 11:12:25 CST 2014
     */
    @Update({
        "update push_record",
        "set name = #{name,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=VARCHAR},",
          "operator = #{operator,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER},",
          "send_time = #{sendTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "create_time = #{createTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP,typeHandler=com.baseweb.mybatis.typehandler.JodaDateTime2TimestampTypeHandler}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(PushRecord record);
}